package com.orhon.smartcampus.modules.base.mm;

import com.orhon.smartcampus.modules.base.entity.Periods;
import com.orhon.smartcampus.modules.base.gqlModel.GQLPeriod;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper(
        uses = {
                LangMapper.class
        }
)
public interface PeriodMapper {


    PeriodMapper MAPPER = Mappers.getMapper(PeriodMapper.class);


    @Mapping(source = "id" , target = "id")
    @Mapping(source = "periodSlug" , target = "slug")
    @Mapping(source = "periodNumber" , target = "number")
    @Mapping(source = "periodOrder" , target = "order")
    @Mapping(source = "mark" , target = "mark")
    @Mapping(source = "createdAt" , target = "created_at")
    @Mapping(source = "updatedAt" , target = "updated_at")
    @Mapping(source = "deletedAt" , target = "deleted_at")
    @Mapping(source = "periodName" , target = "name")//lang
    GQLPeriod toPeriods(Periods entity);


    @InheritConfiguration(name = "toPeriods")
    List<GQLPeriod> toPeriodsList(List<Periods> entities);
}
